#ifndef GAME_H
#define GAME_H
#include <QPainter>
#include <QDialog>
#include<QMouseEvent>
#include<QEvent>
#include <QMessageBox>
#include <QCloseEvent>
#include"mainwindow.h"
#include<QEventLoop>
#include<QTime>
namespace Ui {
class game;
}

class game : public QDialog
{
    Q_OBJECT

public:
    explicit game(QWidget *parent = 0);
    ~game();
    const int WIDTH=100;
    const int x=20,y=20;
    int first1=1;
    int pva=0;
    int zi[9][10];
    int zi1[9][10];
    int back[9][10];
    int last=-1;
    int three[8][3]={{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}};
    int soon=-1;
    int nowwin=0;

private slots:
    void on_pushButton_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_2_clicked();

private:
    Ui::game *ui;
    void closeEvent(QCloseEvent *event);
    void paintEvent(QPaintEvent *);
    QPainter *paint;
    void mousePressEvent(QMouseEvent *event);
    void xia(int aa,int bb);
    void judge(int a[9][10]);
    void win();
    int ai();
    int ai2();
    void copy();
    void copy1();
    void copy2();
    int  score(int x);
    int  score2(int x);
    void sleep();
    void winned();

signals:
    void sendsignal();
};

#endif // GAME_H
